%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% This program replicates Figure 8 in the paper "Optimal 
%%% Portfolio Choice with Fat Tails and Parameter Uncertainty",
%%% Journal of Financial and Quantitative Analysis (2024),
%%% Raymond Kan & Nathan Lassance 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

clear
close all

%%% Load data
load DataFigure8.txt;

%%% Create Figure 8
fig = figure;
set(groot,'defaultAxesTickLabelInterpreter','latex');
%Subplot 1
subplot(3,2,1)
bh = bar(DataFigure8(:,1:3));
bh(1).FaceColor = [0.47 0.67 0.19];  
bh(2).FaceColor = 'b'; 
bh(3).FaceColor = 'r'; 
set(gca,'TickLabelInterpreter','latex');
leg = legend('Normal','$t$','Elliptical','Location','northwest',...
             'interpreter','latex');
set(leg,'Box','off');
grid on
title('10MOM dataset','interpreter','latex');
ylim([-0.1 0.35]);
yticks([-0.1 0 0.1 0.2 0.3]);
xticklabels({'$T=60$ (2f)','$T=120$ (2f)','$T=240$ (2f)','$T=60$ (3f)',...
             '$T=120$ (3f)','$T=240$ (3f)'});
%Subplot 2
subplot(3,2,2)
bh = bar(DataFigure8(:,4:6));
bh(1).FaceColor = [0.47 0.67 0.19];  
bh(2).FaceColor = 'b'; 
bh(3).FaceColor = 'r'; 
set(gca,'TickLabelInterpreter','latex');
grid on
title('16ANOM dataset','interpreter','latex');
ylim([-0.6 0.6]);
yticks([-0.6 -0.3 0 0.3 0.6]);
xticklabels({'$T=60$ (2f)','$T=120$ (2f)','$T=240$ (2f)','$T=60$ (3f)',...
             '$T=120$ (3f)','$T=240$ (3f)'});%Subplot 3
subplot(3,2,3)
bh = bar(DataFigure8(:,7:9));
bh(1).FaceColor = [0.47 0.67 0.19];  
bh(2).FaceColor = 'b'; 
bh(3).FaceColor = 'r'; 
set(gca,'TickLabelInterpreter','latex');
grid on
title('25SBETA dataset','interpreter','latex');
ylim([-0.6 0.2]);
yticks([-0.6 -0.4 -0.2 0 0.2]);
xticklabels({'$T=60$ (2f)','$T=120$ (2f)','$T=240$ (2f)','$T=60$ (3f)',...
             '$T=120$ (3f)','$T=240$ (3f)'});
%Subplot 4
subplot(3,2,4)
bh = bar(DataFigure8(:,10:12));
bh(1).FaceColor = [0.47 0.67 0.19];  
bh(2).FaceColor = 'b'; 
bh(3).FaceColor = 'r'; 
set(gca,'TickLabelInterpreter','latex');
grid on
title('25SBTM dataset','interpreter','latex');
ylim([-0.4 0.4]);
yticks([-0.4 -0.2 0 0.2 0.4]);
xticklabels({'$T=60$ (2f)','$T=120$ (2f)','$T=240$ (2f)','$T=60$ (3f)',...
             '$T=120$ (3f)','$T=240$ (3f)'});
%Subplot 5
subplot(3,2,5)
bh = bar(DataFigure8(:,13:15));
bh(1).FaceColor = [0.47 0.67 0.19];  
bh(2).FaceColor = 'b'; 
bh(3).FaceColor = 'r'; 
set(gca,'TickLabelInterpreter','latex');
grid on
title('25OPINV dataset','interpreter','latex');
ylim([-0.6 0.3]);
yticks([-0.6 -0.4 -0.2 0 0.2]);
xticklabels({'$T=60$ (2f)','$T=120$ (2f)','$T=240$ (2f)','$T=60$ (3f)',...
             '$T=120$ (3f)','$T=240$ (3f)'});
%Subplot 6
subplot(3,2,6)
bh = bar(DataFigure8(:,16:18));
bh(1).FaceColor = [0.47 0.67 0.19];  
bh(2).FaceColor = 'b'; 
bh(3).FaceColor = 'r'; 
set(gca,'TickLabelInterpreter','latex');
grid on
title('30IND dataset','interpreter','latex');
ylim([-0.45 0.1]);
yticks([-0.4 -0.3 -0.2 -0.1 0 0.1]);
xticklabels({'$T=60$ (2f)','$T=120$ (2f)','$T=240$ (2f)','$T=60$ (3f)',...
             '$T=120$ (3f)','$T=240$ (3f)'});
fontsize(fig,10,"points");